<?php

$deId = $_GET['pid'] > 0 ? $_GET['pid'] : $_POST['deId'];

if ($deId < 1 || $deId == '') {

    header('Location: part_location_list.php');
    exit;
}

error_reporting(E_ALL);

include_once('../controller/includes/db_access.php');

if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'multiple') {

    $partlocation_id = $_POST['deId'];

    $q = new Query;
    $q
            ->delete_from('`partlocation`')
        
           
            ->where_equal_to(
                    array(
                        '`partlocation`.`partlocation_id`' => $partlocation_id
                    )
            )
            ->limit(1);

    $result = $q->run();
    $get_deleted_id = $q->get_deleted();
    if (!($result && $get_deleted_id > 0)){
        
        $Error = 'No category found.' . "\n";
        
    } else 
        {

           header('Location: part_location_list.php');  
           
        }
}
?>

<?php
if(isset($_GET['pid'])){

$id = $_GET['pid'];
$q = new Query;
$q
        ->select('*'
        )
        ->from('`partlocation`')
        ->where_equal_to(
                array(
                    '`partlocation`.`partlocation_id`' => $id,
                )
);

$result = $q->run();

if (!($result > 0)) {
    $Error = 'No category found.' . "\n";
} else {
    $rows = mysql_fetch_object($result);
}}
?>



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!--[if lt IE 9]>
<script
src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="styles/style.css" type="text/css" />
<!--[if lte IE 7]>
<link rel="stylesheet" href="style_ie.css" />
<![endif]-->
<title>dbme!!!!</title>
</head>
<body>
<div id="bloc_page">
<header>
 <a href="#"><img src="../images/dBmelogo.png" alt="referentie" alt="dbme!" /></a>
</header>  
 <nav>
    <?php include_once('header.php'); ?>
</nav>
 <section>
  <aside>
  <!--right side baar -->  
  </aside>
     
  <article>              
        <table border="0" cellspacing="5" cellpadding="5">
            <thead>
                <tr>
                    <th colspan="2"></th>
                </tr>
            </thead>
            <tbody>
            <form name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
                <input type="hidden" name="action" value="multiple" />  
                <input type="hidden" name="deId" value="<?php echo $deId; ?>" /> 
                <tr>
                    <td colspan="2"><h1>partener locatie verwijderen</h1><br/><br/>
                    <?php if (isset($Error)) { echo $Error;}?>
                    </td>
                </tr>
                <tr>
                    <td valign="top">naam:
                    </td>
                    <td valign="top">
                        <?php echo $rows->naam; ?>
                    </td>
                </tr>
                <tr>
                    <td valign="top">beschrijving:<br />

                    </td>
                    <td valign="top">
                        
                    <?php echo $rows->descr; ?>
                       

                    </td>
                    
                </tr>
                 <tr>
                    <td valign="top">link:<br />

                    </td>
                    <td valign="top">
                        
                    <?php echo $rows->url; ?>
                       

                    </td>
                    
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" value="delete" name="delete" size="20" />
                    </td>
                </tr>
            </form></tbody>
    </table>    

    </article>
 
    <aside>
  <!--right side baar -->
       
        
   </aside>
</section>
 
 <footer>  
<p>Lorem ipsum dolor sit amet...</p>
<p>Vivamus sed libero nec mauris pulvinar facilisis ut non sem...</p>
<p>Phasellus ligula massa, congue ac vulputate non, dignissim at augue...</p>
</footer>
</div>
</body>
</html>

